package sky.ikaros.android_plugin_log;

import android.annotation.SuppressLint;

public class AndroidPluginLogFactory {
    @SuppressLint("StaticFieldLeak")
    private static AndroidPluginLog log;
    public static AndroidPluginLog getLogger(){
        if(log == null) log = new AndroidPluginLog();
        return log;
    }
    public static void catchUncaughtExceptionHandler(){
        Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> getLogger().e("ApplicationException", ex.getMessage(), ex));
    }
    public static void release(){
        if(log != null) log.release();
        log = null;
    }

}
